package com.qfedu.com.qianfeedu.controller;

import com.qfedu.com.qianfeedu.entity.User;
import org.springframework.web.bind.annotation.*;

//http://localhost:8080/user/AllUser/method1

@RestController
@RequestMapping("/user")
public class UserController {

    @RequestMapping(value = "/getAllUser")
    public String getUser(){
        return "张三";
    }


    @RequestMapping(value = "/getAllUser/method1")
    public String getUser1(){
        return "李四";
    }



    @RequestMapping(value = "/getAUser")
    public String getUserWithparams(String username,String password){

        if(username == null || username.trim() == "" ||password == null){
            return "您输入的用户名密码有误！";
        }
        System.out.println("春江潮水连海平!");
        System.out.println(username);
        System.out.println(password);


        return "张三";
    }



@PostMapping
    (value = "/selectAUser")
    public String getUserWithparams1(@RequestBody User user){
        System.out.println(user.getName());
        System.out.println(user.getSex());
        System.out.println(user.getAge());

        return "我的名字是：" + user.getName() + "我是"+ user.getSex() + "我" + user.getAge() + "岁";
    }
}
